package com.yumijinfu.response;

import com.yumijinfu.entity.HongBaoInfo;

import org.json.*;
import java.util.ArrayList;

public class HongBaoRes {
	
    private String currentPage;
    private String pageSize;
    private String totalPage;
    private ArrayList<HongBaoInfo> page;
    
    
	public HongBaoRes () {
		
	}	
        
    public HongBaoRes (JSONObject json) {
    
        this.currentPage = json.optString("currentPage");
        this.pageSize = json.optString("pageSize");
        this.totalPage = json.optString("totalPage");

        this.page = new ArrayList<HongBaoInfo>();
        JSONArray arrayPage = json.optJSONArray("page");
        if (null != arrayPage) {
            int pageLength = arrayPage.length();
            for (int i = 0; i < pageLength; i++) {
                JSONObject item = arrayPage.optJSONObject(i);
                if (null != item) {
                    this.page.add(new HongBaoInfo(item));
                }
            }
        }
        else {
            JSONObject item = json.optJSONObject("page");
            if (null != item) {
                this.page.add(new HongBaoInfo(item));
            }
        }


    }
    
    public String getCurrentPage() {
        return this.currentPage;
    }

    public void setCurrentPage(String currentPage) {
        this.currentPage = currentPage;
    }

    public String getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(String pageSize) {
        this.pageSize = pageSize;
    }

    public String getTotalPage() {
        return this.totalPage;
    }

    public void setTotalPage(String totalPage) {
        this.totalPage = totalPage;
    }

    public ArrayList<HongBaoInfo> getPage() {
        return this.page;
    }

    public void setPage(ArrayList<HongBaoInfo> page) {
        this.page = page;
    }


    
}
